
function ALFA = getALFA(params)

U0       = params.U0;
U0d      = params.U0d;
BETTA    = params.BETTA;
B        = params.B;
CHI      = params.CHI;
CHI0     = params.CHI0;
THETA    = params.THETA;
DELTA    = params.DELTA;
PHI      = params.PHI;
ETA      = params.ETA;
ZI       = params.ZI;
NU       = params.NU;
MUZss    = params.MUZss;
lss      = params.lss;
KoY      = params.KoY;
PAIss    = params.PAIss;
CRRA     = params.CRRA;
%% Section 2: Solving for the steady state
% The real stoch discount factor
Mreal      = BETTA*MUZss^(-CHI*(1-CHI0)-CHI0);

% Value of capital
Kss        = ((4*KoY)^(1/(1-THETA)))*lss;  

% The output level
OUTPUTss   = Kss^THETA*lss^(1-THETA);

% The consumption level
Css        = (1-ZI/2*(PAIss/PAIss^NU-1)^2)*OUTPUTss - DELTA*Kss;

% Marginal costs
MCss       = 1/(ETA*OUTPUTss)*(ZI*(PAIss/PAIss^NU-1)*OUTPUTss*PAIss/PAIss^NU ...
               -(1-ETA)*OUTPUTss + ZI*Mreal*(PAIss/PAIss^NU-1)*PAIss/PAIss^NU*OUTPUTss*MUZss);

% The real wage
Wss        = MCss*(1-THETA)*Kss^THETA*lss^(-THETA);

% The parameter on disutility
PHIzero    = ((Css-B*Css*MUZss^-1)/Css^CHI0)^-CHI*Wss*(1-lss)^(1/PHI)/Css^CHI0;

% CRRA
term1 = CHI/(1-B*MUZss^-1+Wss/Css*CHI*(1-lss)/(1/PHI));
term2 = (1-CHI)/((1-CHI)*(U0+U0d)/Css^(CHI0*(CHI-1)+1)*(Css-B*Css*MUZss^-1)^CHI + (1-B*MUZss^-1)+ Wss/Css*(1-lss)*(1-CHI)/(1-1/PHI));
ALFA  = (CRRA-term1)/term2; 

% Simple
% u      = U0+U0d+Css^(CHI0*(CHI-1))/(1-CHI)*(Css-Css*B/MUZss)^(1-CHI) + PHIzero*(1-lss)^(1-1/PHI)/(1-1/PHI);
% u1     = Css^(CHI0*(CHI-1))*(Css-Css*B/MUZss)^-CHI;
% u11    = -CHI*Css^(CHI0*(CHI-1))*(Css-Css*B/MUZss)^(-CHI-1);
% u2     = -PHIzero*(1-lss)^(-1/PHI);
% u22    = -1/PHI*PHIzero*(1-lss)^(-1/PHI-1);
% lambda = Wss*u11/u22;
% %u2    = -PHIzero*(1-lss)^(-1/PHI);
% %Wss_test = -u2/u1; 
% ALFA = (CRRA/Css + u11/u1*1/(1+Wss*lambda))*u/u1;

end